package org.gw.building.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.gw.building.dto.Tyxx;
import org.gw.building.model.base.Cc;
import org.gw.building.model.base.Lb;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;


/**
 * Created by qwx89 on 2017/7/23.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "T_XTGL_BM")
@Builder
//部门
public class Bm {

  @Id
  @GeneratedValue(generator = "uuid")
  @GenericGenerator(name = "uuid", strategy = "uuid")
  private String id;

  @Column(length = 12)
  //代码
  private String dm;

  @Column(length = 60)
  //名称
  private String mc;

  @JoinColumn(name = "cc")
  @OneToOne
  //T_BZXT_CC.dm
  private Cc cc;

  @JoinColumn(name = "lsbm")
  @OneToOne
  //隶属部门（bm.id）
  private Bm lsbm;

  @Column
  //是否学生院系
  private boolean xsyx;

  @Column
  //是否有效
  private boolean sfyx;

  @Column
  //排序
  private int px;

  @Column(length = 40)
  //所属院系（bm.id）
  private String ssyx;

  @JoinColumn(name = "lb")
  @OneToOne
  //类别（lb.dm）
  private Lb lb;

  @Column
  //建立年月（2000-2100）
  private int jlny;

  @Column
  //失效日期
  private Date sxrq;

  @Transient
  private Tyxx tyxx;

  public Bm(String id){
    this.id = id;
  }
}
